package com.servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import net.sf.json.JSONObject;

import com.Dao.userdao;
import com.page.page;

public class pagequeryuserservlet extends HttpServlet {

	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
			this.doPost(request,response);
	}

	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		request.setCharacterEncoding("utf-8");
		String curr = request.getParameter("curr");
		int currentpage = 1;
		try{
			currentpage = Integer.parseInt(curr);
		}catch(Exception e){
			currentpage = 1;
		}
		userdao udao = new userdao();
		page p = udao.pagequeryuser(currentpage);
		
		request.getSession().setAttribute("userpage", p );
		request.getSession().setAttribute("userface", 2);
		response.sendRedirect(request.getContextPath()+"/background/admin_user_manager.jsp");
		
		
		
	}

}
